﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BLL;
namespace 健身房管理
{
    public partial class UserLost : UserControl
    {
        wuyiBLL wbl = new wuyiBLL();
        public UserLost()
        {
            InitializeComponent();
        }

        private void guna2Button6_Click(object sender, EventArgs e)
        {
            PrintDGV.Print_DataGridView(this.dgvL);

        }

        private void UserLost_Load(object sender, EventArgs e)
        {
            jiaz();
        }
        public void jiaz()
        {
            DataTable dt = wbl.wuyishow();
            this.dgvL.DataSource = dt;

        }

        private void guna2Button1_Click(object sender, EventArgs e)
        {
            wuyiAdd wad = new wuyiAdd();
            wad.Show();
        }

        private void guna2Button5_Click(object sender, EventArgs e)
        {
            wuyiModify wxg = new wuyiModify();
            wxg.wyid = int.Parse(this.dgvL.CurrentRow.Cells["id"].Value.ToString());
            wxg.Show();
        }

        private void 刷新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            jiaz();   
        }

        private void guna2Button7_Click(object sender, EventArgs e)
        {
            int id = int.Parse(this.dgvL.CurrentRow.Cells["id"].Value.ToString());
            mModify xg = new mModify();

            bool b1 = wbl.wydel(id);
            if (b1)
            {
                MessageBox.Show("删除成功");
            }
            else
            {
                MessageBox.Show("删除失败");
            }
        }

        private void guna2Button9_Click(object sender, EventArgs e)
        {
            jiaz();
        }

        private void guna2Button2_Click(object sender, EventArgs e)
        {
            int wuyiall = 0;
            int wuyitake = 0;
            if (this.guna2CheckBox2.Checked)
            {
                wuyiall = 1;
            }
            if (guna2CheckBox1.Checked)
            {
                wuyitake = 2;
            }
            this.dgvL.DataSource = wbl.cxwuyi(this.guna2TextBox1.Text,wuyiall,wuyitake);
            
        }
    }
}
